home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Devel::SelfStubber.Z / Devel::SelfStubber
Encoding:
Text File  |  1998-10-28  |  4.0 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      DDDDeeeevvvveeeellll::::::::SSSSeeeellllffffSSSSttttuuuubbbbbbbbeeeerrrr2222((((33333333////))))JJJJuuuullll////99998888    ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhhDDDDeeee0000vvvv2222eeee))))llll::::::::SSSSeeeellllffffSSSSttttuuuubbbbbbbbeeeerrrr((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Devel::SelfStubber - generate    stubs for a SelfLoading    module
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.       To generate just the stubs:
  13.  
  14.           use Devel::SelfStubber;
  15.           Devel::SelfStubber->stub('MODULENAME','MY_LIB_DIR');
  16.  
  17.       or to    generate the whole module with stubs inserted
  18.       correctly
  19.  
  20.           use Devel::SelfStubber;
  21.           $Devel::SelfStubber::JUST_STUBS=0;
  22.           Devel::SelfStubber->stub('MODULENAME','MY_LIB_DIR');
  23.  
  24.       MODULENAME is    the Perl module    name, e.g. Devel::SelfStubber,
  25.       NOT 'Devel/SelfStubber' or 'Devel/SelfStubber.pm'.
  26.  
  27.       MY_LIB_DIR defaults to '.' if    not present.
  28.  
  29.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  30.       Devel::SelfStubber prints the    stubs you need to put in the
  31.       module before    the __DATA__ token (or you can get it to print
  32.       the entire module with stubs correctly placed). The stubs
  33.       ensure that if a method is called, it    will get loaded. They
  34.       are needed specifically for inherited    autoloaded methods.
  35.  
  36.       This is best explained using the following example:
  37.  
  38.       Assume four classes, A,B,C & D.
  39.  
  40.       A is the root    class, B is a subclass of A, C is a subclass
  41.       of B,    and D is another subclass of A.
  42.  
  43.                   A
  44.                  / \
  45.                 B   D
  46.                    /
  47.                   C
  48.  
  49.       If D calls an    autoloaded method 'foo'    which is defined in
  50.       class    A, then    the method is loaded into class    A, then
  51.       executed. If C then calls method 'foo', and that method was
  52.       reimplemented    in class B, but    set to be autoloaded, then the
  53.       lookup mechanism never gets to the AUTOLOAD mechanism    in B
  54.       because it first finds the method already loaded in A, and
  55.       so erroneously uses that. If the method foo had been stubbed
  56.       in B,    then the lookup    mechanism would    have found the stub,
  57.       and correctly    loaded and used    the sub    from B.
  58.  
  59.       So, for classes and subclasses to have inheritance correctly
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      DDDDeeeevvvveeeellll::::::::SSSSeeeellllffffSSSSttttuuuubbbbbbbbeeeerrrr2222((((33333333////))))JJJJuuuullll////99998888    ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhhDDDDeeee0000vvvv2222eeee))))llll::::::::SSSSeeeellllffffSSSSttttuuuubbbbbbbbeeeerrrr((((3333))))
  71.  
  72.  
  73.  
  74.       work with autoloading, you need to ensure stubs are loaded.
  75.  
  76.       The SelfLoader can load stubs    automatically at module
  77.       initialization with the statement 'SelfLoader-
  78.       >_l_o_a_d__s_t_u_b_s()';, but you may wish to avoid having the    stub
  79.       loading overhead associated with your    initialization (though
  80.       note that the    SelfLoader::load_stubs method will be called
  81.       sooner or later - at latest when the first sub is being
  82.       autoloaded). In this case, you can put the sub stubs before
  83.       the __DATA__ token. This can be done manually, but this
  84.       module allows    automatic generation of    the stubs.
  85.  
  86.       By default it    just prints the    stubs, but you can set the
  87.       global $Devel::SelfStubber::JUST_STUBS to 0 and it will
  88.       print    out the    entire module with the stubs positioned
  89.       correctly.
  90.  
  91.       At the very least, this is useful to see what    the SelfLoader
  92.       thinks are stubs - in    order to ensure    future versions    of the
  93.       SelfStubber remain in    step with the SelfLoader, the
  94.       SelfStubber actually uses the    SelfLoader to determine    which
  95.       stubs    are needed.
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.